Field of the Invention
The present invention relates to a communication apparatus, a method for controlling the same, and a non-transitory computer-readable storage medium.
Description of the Related Art
In recent years, a wireless LAN (Local Area Network) is being mounted in a terminal device such as a cellular phone, digital camera, or printing apparatus in addition to a PC (Personal Computer).
The connection forms of wireless LAN devices include an infrastructure mode in which a terminal performs communication under the control of a base station via the base station and an ad hoc mode in which terminals directly communicate with each other.
The base station is generally necessary when communicating in the infrastructure mode. However, there is proposed a technique in which a portable base station function is imparted to a terminal in an environment having no base station to implement communication in the infrastructure mode between terminals. The Wi-Fi Alliance as the wireless LAN industrial group standardizes Wi-Fi Direct™ which defines the specification for implementing direct communication between terminals using the terminal having the portable base station function (see “Wi-Fi Peer-to-Peer (P2P) Technical Specification Version 1.1”, Wi-Fi Alliance, 2010).
Wi-Fi Direct™ describes a method of deciding a device operating as a portable base station, a method of setting parameters for connecting to a device serving as the portable base station, and a connection method between terminals complying with the specification.
Wi-Fi Direct™ defines the device operating as the portable base station as P2P (Peer-to-Peer) GO (Group Owner) and a terminal device connecting to the P2P GO as a P2P Client. In the method of deciding the P2P GO, capability information is exchanged between the terminals to decide a device serving as the P2P GO. The device decided as the P2P GO activates the portable base station function to establish a wireless LAN network. The P2P Client executes wireless LAN parameter setting by WPS (Wi-Fi Protected Setup) with the wireless LAN network established by the P2P GO, thereby performing automatic connection. Accordingly, the P2P GO and the P2P Client form a wireless LAN network called a P2P group. Direct communication can be performed by the wireless LAN between the P2P GO and the P2P Client in the P2P group.
After the direct communication by the wireless LAN becomes possible, the P2P Client performs IP (Internet Protocol) address obtaining processing to the P2P GO. The IP address obtaining processing is executed using the DHCP (Dynamic Host Configuration Protocol) client function.
Similarly, the P2P GO activates the DHCP server function and distributes an IP address by DHCP in response to the IP address obtaining a request from the P2P Client. When activating the DHCP server function, the P2P GO sets the local IP address in a network I/F (Interface).
When the P2P Client obtains the IP address by the DHCP client function, the P2P Client sets the obtained IP address in the network I/F, thereby allowing IP communication.
Depending on terminal types, overlap confirmation processing to determine whether the obtained IP addresses overlap in the network must be performed after obtaining the IP addresses and before setting the IP addresses in the network I/F.
The IP address overlap confirmation processing can be executed using the Gratuitous ARP (Address Resolution Protocol) (to be referred to as GARP hereinafter). Unlike the general ARP, the GARP is transmitted after the local IP address is set in the Target Address Protocol field of an ARP packet. If devices in which identical IP addresses are set exist in a network, an ARP Reply is sent back to the GARP transmission source as a response to the GARP serving as an ARP Request from the device. The presence/absence of the response to the GARP allows IP address overlap confirmation.
However, in the overlap confirmation of IP addresses obtained by the DHCP, the GARP transmission count and the like are not defined. The GARP transmission count and its period are implementation-dependent.
It can be assumed that a specific service is executed between the P2P Go and the P2P Client after forming the P2P group. The services are exemplified as a printing service, an image exchange service, and the like. Even if the P2P GO serves as the start side of data communication for a service and starts the data communication for the service immediately after IP address distribution processing, the P2P Client may be executing the IP address overlap confirmation.
When the P2P Client executes the IP address overlap confirmation before setting the IP address in the network I/F, the P2P Client cannot receive data for the service, and the data must be retransmitted.
The data retransmission count, the transmission timeout, and the like may be set depending on types of services. For this reason, the retransmission count may reach a default value or the transmission timeout may occur, thus failing data communication for a service.
In consideration of the above problems, the present invention provides a technique for preventing mismatching between the start timings of data communication for a service with a partner communication apparatus and suppressing the occurrence of data retransmission and transmission timeout.